<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAttachmentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('attachments', function (Blueprint $table) {
            $table->id();
            $table->string('file')->default('')->comment('附件名称 (带有路径)');
            $table->string('url')->default('')->comment('附件 URL');
            $table->char('mime_type', 32)->default('')->comment('文件格式');

            $table->string('wx_media_id')->default('')->comment('微信素材 ID');
            $table->string('wx_media_url')->default('')->comment('微信素材 URL');
            $table->json('wx_media_response')->nullable()->comment('微信素材返回数据');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('attachments');
    }
}
